package cn.jn.lhm.part04;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

/**
 * @author lhm 2753914576@qq.com
 * @time 2023/4/5 - 22:32
 **/
public class Client {
    public static void main(String[] args) throws IOException {
        SocketChannel client = SocketChannel.open();
        client.connect(new InetSocketAddress("localhost", 9999));

        ByteBuffer buffer = ByteBuffer.allocate(1024 * 1024);
        int count = 0;
        while (true) {
            int read = client.read(buffer);
            count += read;
            buffer.clear();
            System.out.println(count);
        }


    }
}
